import 'package:safetymonitor/app/components/custom_app_bar.dart';
import 'package:safetymonitor/app/core/core.dart';
import 'package:safetymonitor/modules/home/alarm_warning/completed/view.dart';
import 'package:safetymonitor/modules/home/alarm_warning/no_completed/view.dart';

import 'controller.dart';
///预警报警
class AlarmWarningPage extends StatelessWidget {
  AlarmWarningPage({super.key});

  final controller = Get.put(AlarmWarningController());

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: AppColors.bg_color_grey,
      appBar: CustomAppBar(
        titleText: '预警报警',
      ),
      body: DefaultTabController(
        length: 2,
        initialIndex: controller.initPage,
        child: Column(
          children: [
            Container(
              padding: EdgeInsets.symmetric(horizontal: 30.w),
              decoration: BoxDecoration(
                color: Colors.white,
                borderRadius: BorderRadius.circular(8),
              ),
              height: 54.w,
              child: TabBar(
                enableFeedback: false,
                tabs: const [
                  Tab(text: '待完成'),
                  Tab(text: '已完成'),
                ],
                dividerColor: Colors.transparent,
                labelPadding: EdgeInsets.only(bottom: 10.w),
                labelStyle: TextStyle(
                  fontSize: 16.sp,
                  fontWeight: FontWeight.w500,
                ),
                unselectedLabelStyle: TextStyle(
                  fontSize: 16.sp,
                  fontWeight: FontWeight.w500,
                ),
                labelColor: Colors.black,
                unselectedLabelColor: const Color(0xffA0A7B5),
                indicatorPadding: EdgeInsets.only(top: 36.w, bottom: 10.w),
                indicator: const BoxDecoration(
                  image: DecorationImage(
                    image: AssetImage(
                      'assets/images/icon_select_arc.png',
                    ),
                  ),
                ),
              ),
            ),
            Expanded(
              child: Container(
                color: const Color(0xffF5F5F6),
                child: TabBarView(
                  children: [
                    AlarmNoCompletedPage(),
                    AlarmCompletedPage(),
                  ],
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
}
